package com.test.other;

public class ShowEnum {
	enum Constants2{
		Constants_A,
		Constants_B,
		Constants_C
	}
	public static void compare(Constants2 c){
		for(int i=0;i<Constants2.values().length;i++){
			System.out.println(c+"与"+Constants2.values()[i]+"比较的结果为："+c.compareTo(Constants2.values()[i]));
		}
	}
/*	
 	//values()方法实例
	public static void main(String [] args){
		for(int i=0;i<Constants2.values().length;i++){
			System.out.println("枚举类型成员变量："+Constants2.values()[i]);
		}
	}
*/
/*
	//compareTo()方法实例
	public static void main(String []args){
		compare(Constants2.valueOf("Constants_B"));
	}
*/

	//ordinal()方法
	public static void main(String [] args){
		for(int i=0;i<Constants2.values().length;i++){
			System.out.println(Constants2.values()[i]+"在枚举类型中的索引值"+Constants2.values()[i].ordinal());
		}
	}

}